package guowenlong.golf.ui.dynamic.notify;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.Window;
import android.widget.TextView;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import guowenlong.golf.R;
import guowenlong.golf.ui.home.TabAdapter;
import java.util.ArrayList;
import java.util.List;

/**
 * des   : 描述
 * author: Administrator
 * email : guowenlong20000@gmail.com
 * time  : 2017年03月31日 上午 12:41.
 */

public class NotifyActivity extends FragmentActivity {

  @BindView(R.id.tv_back)
  TextView tvBack;
  @BindView(R.id.tl_home)
  TabLayout tlHome;
  @BindView(R.id.vp_view)
  ViewPager vpView;
  private FragmentPagerAdapter fAdapter;                               //定义adapter

  private List<Fragment> list_fragment;                                //定义要装fragment的列表
  private List<String> list_title;                                     //tab名称列表

  private FriendFragment mFriendFragment;
  private SystemFragment mSystemFragment;
  private TeamFragment mTeamFragment;

  @Override
  protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.activity_notify);
    ButterKnife.bind(this);

    mFriendFragment = new FriendFragment();
    mSystemFragment = new SystemFragment();
    mTeamFragment = new TeamFragment();

    list_fragment = new ArrayList<>();
    list_fragment.add(mSystemFragment);
    list_fragment.add(mTeamFragment);
    list_fragment.add(mFriendFragment);

    list_title = new ArrayList<>();
    list_title.add("系统通知");
    list_title.add("球队通知");
    list_title.add("好友通知");
    tlHome.setTabMode(TabLayout.MODE_FIXED);
    tlHome.addTab(tlHome.newTab().setText(list_title.get(0)));
    tlHome.addTab(tlHome.newTab().setText(list_title.get(1)));
    tlHome.addTab(tlHome.newTab().setText(list_title.get(2)));

    fAdapter = new TabAdapter(getSupportFragmentManager(), list_fragment, list_title);

    //viewpager加载adapter
    vpView.setAdapter(fAdapter);
    //tab_FindFragment_title.setViewPager(vp_FindFragment_pager);
    //TabLayout加载viewpager
    tlHome.setupWithViewPager(vpView);
    //tab_FindFragment_title.set
  }

  @OnClick(R.id.tv_back)
  public void onViewClicked() {
    finish();
  }
}
